import Cookies from 'js-cookie'

const TokenKey = 'Admin-Token'

export function getToken() {
  return Cookies.get(TokenKey)
}

export function setToken(token) {
  return Cookies.set(TokenKey, token)
}

export function removeToken() {
  return Cookies.remove(TokenKey)
}
export function setUser(user) {
  let userStr = JSON.stringify(user)
  Storage.volatileSet('user', userStr)
}
export function getUser() {
  let userStr = Storage.volatileGet('user')
  return JSON.parse(userStr)
}

export function removeUser() {
  Storage.volatileClear()
}
